package com.itheima.shop.decorator_review;

import com.itheima.shop.dao.ItemDao;
import com.itheima.shop.domain.Item;
import com.itheima.shop.domain.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @program: design
 * @description:
 * @author: zhanghz001
 * @create: 2021-02-27 15:47
 **/
@Service
public class OrderMoneySumReview implements MoneySumReview {
    @Autowired
    private ItemDao itemDao;
    
    @Override
    public void sum(Order order) {
        Item item = itemDao.findById(order.getItemId());
        order.setPaymoney(item.getPrice() * order.getNum());
        order.setMoney(item.getPrice() * order.getNum());
    }
}
